﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdOleItemHandler : OdGiSelfGdiDrawable_Internal
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdOleItemHandler(IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdOleItemHandler obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdOleItemHandler()
		{
			this.Dispose();
		}

		public new virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdOleItemHandler(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public new static OdOleItemHandler cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdOleItemHandler_cast(OdRxObject.getCPtr(pObj));
			OdOleItemHandler result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdOleItemHandler)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdOleItemHandler)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdOleItemHandler)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdOleItemHandler_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdOleItemHandler_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdOleItemHandler_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdOleItemHandler createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdOleItemHandler_createObject();
			OdOleItemHandler result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdOleItemHandler)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdOleItemHandler)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdOleItemHandler)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void load(OdStreamBuf streamBuf)
		{
			GlobalsPINVOKE.OdOleItemHandler_load(this.swigCPtr, OdStreamBuf.getCPtr(streamBuf));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void save(OdStreamBuf streamBuf)
		{
			GlobalsPINVOKE.OdOleItemHandler_save(this.swigCPtr, OdStreamBuf.getCPtr(streamBuf));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual uint getCompoundDocumentDataSize()
		{
			uint result = GlobalsPINVOKE.OdOleItemHandler_getCompoundDocumentDataSize(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void getCompoundDocument(OdStreamBuf streamBuf)
		{
			GlobalsPINVOKE.OdOleItemHandler_getCompoundDocument(this.swigCPtr, OdStreamBuf.getCPtr(streamBuf));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setCompoundDocument(uint numBytes, OdStreamBuf streamBuf)
		{
			GlobalsPINVOKE.OdOleItemHandler_setCompoundDocument(this.swigCPtr, numBytes, OdStreamBuf.getCPtr(streamBuf));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdOleItemHandler.Type type()
		{
			OdOleItemHandler.Type result = (OdOleItemHandler.Type)GlobalsPINVOKE.OdOleItemHandler_type(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdOleItemHandler.DvAspect drawAspect()
		{
			OdOleItemHandler.DvAspect result = (OdOleItemHandler.DvAspect)GlobalsPINVOKE.OdOleItemHandler_drawAspect(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual string linkName()
		{
			string result = GlobalsPINVOKE.OdOleItemHandler_linkName(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual string linkPath()
		{
			string result = GlobalsPINVOKE.OdOleItemHandler_linkPath(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual string userType()
		{
			string result = GlobalsPINVOKE.OdOleItemHandler_userType(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setDrawAspect(OdOleItemHandler.DvAspect drawAspect)
		{
			GlobalsPINVOKE.OdOleItemHandler_setDrawAspect(this.swigCPtr, (int)drawAspect);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdOleItemHandler.PlotQuality outputQuality()
		{
			OdOleItemHandler.PlotQuality result = (OdOleItemHandler.PlotQuality)GlobalsPINVOKE.OdOleItemHandler_outputQuality(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setOutputQuality(OdOleItemHandler.PlotQuality quality)
		{
			GlobalsPINVOKE.OdOleItemHandler_setOutputQuality(this.swigCPtr, (int)quality);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual SWIGTYPE_p_COleClientItem getOleClientItem()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdOleItemHandler_getOleClientItem(this.swigCPtr);
			SWIGTYPE_p_COleClientItem result = (intPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_COleClientItem(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		public enum Type
		{
			kUnknown,
			kLink,
			kEmbedded,
			kStatic
		}

		public enum DvAspect
		{
			kContent = 1,
			kThumbnail,
			kIcon = 4,
			kDocPrint = 8
		}

		public enum PlotQuality
		{
			kMonochrome,
			kLowGraphics,
			kHighGraphics,
			kAutomatic
		}
	}
}
